import Vue from 'vue';
import VueRouter from 'vue-router';
import Routers from "./router";
import iView from 'iview';

Vue.use(VueRouter)

// 路由配置
const RouterConfig = {
  mode: 'history',
  routes: Routers
};
const router = new VueRouter(RouterConfig);

/*路由跳转前拦截*/
router.beforeEach((to, from, next) => {
  iView.LoadingBar.start();
  next();
});

/*路由跳转后拦截*/
router.afterEach(() => {
  iView.LoadingBar.finish();
  window.scrollTo(0, 0);
});

export default router;


